<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<h1>Base de Solicitações</h1>

		<h:form id="solicitacaomudancaSearch" styleClass="edit">

			<rich:simpleTogglePanel label="Filtros de Busca" switchType="ajax">

				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Título</ui:define>
					<h:inputText id="titulo"
						value="#{solicitacaomudancaList.solicitacaomudanca.titulo}" />
				</s:decorate>
				
				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Status</ui:define>
					<h:inputText id="status"
						value="#{solicitacaomudancaList.solicitacaomudanca.statusmudanca.nome}" />
				</s:decorate>

				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Nome do Solicitante</ui:define>
					<h:inputText id="solicitante"
						value="#{solicitacaomudancaList.solicitacaomudanca.usuario.nome}" />
				</s:decorate>

				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Nome do Projeto</ui:define>
					<h:inputText id="nomeprojeto"
						value="#{solicitacaomudancaList.solicitacaomudanca.projeto.nome}" />
				</s:decorate>

			</rich:simpleTogglePanel>

			<div class="actionButtons">
				<h:commandButton id="search" value="Search"
					action="/SolicitacaomudancaList.xhtml" />
				<s:button id="reset" value="Reset" includePageParams="false" />
			</div>

		</h:form>

		<rich:panel>
			<f:facet name="header">Solicitações de Mudanças (#{empty solicitacaomudancaList.resultList ? 0 : (solicitacaomudancaList.paginated ? solicitacaomudancaList.resultCount : solicitacaomudancaList.resultList.size)})</f:facet>
			<div class="results" id="solicitacaomudancaList">

				<h:outputText
					value="Nenhuma solicitação encontrada na pesquisa..."
					rendered="#{empty solicitacaomudancaList.resultList}" />

				<rich:dataTable id="solicitacaomudancaList"
					var="_solicitacaomudanca"
					value="#{solicitacaomudancaList.resultList}"
					rendered="#{not empty solicitacaomudancaList.resultList}">
					
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Id da Solicitação" />
								<ui:param name="propertyPath" value="solicitacaomudanca.id" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.id}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Título" />
								<ui:param name="propertyPath" value="solicitacaomudanca.titulo" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.titulo}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Status da Solicitação" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.statusmudanca.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.statusmudanca.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="nome do Projeto" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.projeto.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.projeto.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Nome do Solicitante" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.usuario.nome" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.usuario.nome}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Data Abertura" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.dataabertura" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.dataabertura}">
							<s:convertDateTime type="both" dateStyle="short" />
						</h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Data Fechamento" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.datafechamento" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.datafechamento}">
							<s:convertDateTime type="both" dateStyle="short" />
						</h:outputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Descricao" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.descricao" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.descricao}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<ui:include src="layout/sort.xhtml">
								<ui:param name="entityList" value="#{solicitacaomudancaList}" />
								<ui:param name="propertyLabel" value="Justificativa" />
								<ui:param name="propertyPath"
									value="solicitacaomudanca.justificativa" />
							</ui:include>
						</f:facet>
						<h:outputText value="#{_solicitacaomudanca.justificativa}" />
					</h:column>
					<rich:column styleClass="action">
						<f:facet name="header">Ação</f:facet>
						<s:link view="/view/projeto.xhtml"
							value="Ver Projeto"
							propagation="none"
							id="solicitacaomudancaViewId">
							<f:param name="projetoId"
								value="#{_solicitacaomudanca.projeto.id}" />
						</s:link>
            <br/>
            <br/>
            <s:link view="/SolicitacaomudancaEdit.xhtml" value="Encerrar Solicitação"
							propagation="none" id="solicitacaomudancaEdit"
							rendered="#{empty from}">
							<f:param name="solicitacaomudancaId"
								value="#{_solicitacaomudanca.id}" />
						</s:link>
					</rich:column>
				</rich:dataTable>

			</div>
		</rich:panel>

		<div class="tableControl">

			<s:link view="/SolicitacaomudancaList.xhtml"
				rendered="#{solicitacaomudancaList.previousExists}"
				value="#{messages.left}#{messages.left} First Page" id="firstPage">
				<f:param name="firstResult" value="0" />
			</s:link>

			<s:link view="/SolicitacaomudancaList.xhtml"
				rendered="#{solicitacaomudancaList.previousExists}"
				value="#{messages.left} Previous Page" id="previousPage">
				<f:param name="firstResult"
					value="#{solicitacaomudancaList.previousFirstResult}" />
			</s:link>

			<s:link view="/SolicitacaomudancaList.xhtml"
				rendered="#{solicitacaomudancaList.nextExists}"
				value="Next Page #{messages.right}" id="nextPage">
				<f:param name="firstResult"
					value="#{solicitacaomudancaList.nextFirstResult}" />
			</s:link>

			<s:link view="/SolicitacaomudancaList.xhtml"
				rendered="#{solicitacaomudancaList.nextExists}"
				value="Last Page #{messages.right}#{messages.right}" id="lastPage">
				<f:param name="firstResult"
					value="#{solicitacaomudancaList.lastFirstResult}" />
			</s:link>

		</div>

		<s:div styleClass="actionButtons" rendered="#{empty from}">
			<s:button view="/SolicitacaomudancaEdit.xhtml" id="create"
				propagation="none" value="Create solicitacaomudanca">
				<f:param name="solicitacaomudancaId" />
			</s:button>
		</s:div>

	</ui:define>

</ui:composition>
